var app = getApp();
var http_service = app.data.service;
Page({
  data: {
    http_service: http_service,
    serviceInfo: {},
    a:'',
  },
  onLoad: function (options) {
    wx.showLoading({
      title: '加载中',
    })
    var serviceId = options.serviceId
    var that = this;



    //请求服务数据
    wx.request({
      url: http_service + '/index.php/getservicebyid',
      data:{
        serviceId:serviceId
      },
      success: function (res) {
        var process = res.data.process;
        var reg = new RegExp('；', "g")
        process = process.replace(reg, '\n');
        that.setData({
          serviceInfo: res.data,
          a: process
        }, function () {
            wx.hideLoading();
        })
      },
    })
  },

  //点击事件
  click: function (e) {
    //这是最终确认选择的service的id
    var serviceId = e.currentTarget.id;
    //将选择的服务id信息存储在本地
    wx.setStorage({
      key: 'serviceId',
      data: serviceId,
    })
    //跳转到确认页
    wx.navigateTo({
      url: '/pages/index/home?serviceId=' + serviceId,
    })
  }

})  
